package com.swyc.osschat.Test.designMode.singleCase.run;

/**
 * @description 静态内部类
 * 优点：懒加载（调用getInstance()时，才会加载内部类实例化），线程安全
 * @Author: z156940l@outlook.com
 * @className SingleObj7
 * @Date: 2022/7/25 18:34
 */
public class SingleObj7 {
    //私有化构造方法，防止外部new
    private SingleObj7(){
    }

    private static class SingleInstance{
        private static final SingleObj7 instance = new SingleObj7();
    }

    //返回实例
    public static SingleObj7 getInstance(){
        return SingleInstance.instance;
    }
}
